package framework.task;

import framework.agent.CustomAgent;

import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.List;

/**
 * @Name: TaskContainer
 * @Description:
 * @Author: colfish
 * @Date: 2021/5/13 16:06
 * 好好学习，天天向上！
 */
public class TaskContainer {
    public static <T> ArrayList<T> createTaskInstance(String taskName, int nums){


        ArrayList<T> taskInstance = new ArrayList<>();
        try {
            Class clazz = Class.forName(taskName);
            Constructor con = clazz.getConstructor();
            for (int i = 0; i < nums; i++) {
                T task = (T) con.newInstance();
                taskInstance.add(task);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return taskInstance;
    }

    public void deleteTaskInstance(String taskName){

    }
}
